home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
COMMUNIC
/
MRUN211.ZIP
/
MRUN211A.WAS
< prev
next >
Wrap
Text File
|
1993-05-01
|
23KB
|
728 lines
;MailRun v2.11: Part A, Main body of script
;1992-1993 Gerald P. Sully, all rights reserved.
#comment
**************************************************************************
**************************************************************************
*
* This file serves as "home base" for the rest of the script.
* All other scripts will return to this one if they are
* exited normally. It initializes MailRun, creates the
* user interface, and then waits for action on the part of the
* user. If the user executes a mailrun, this section is also
* responsible for taking care of scheduling.
*
* Elements of the user interface are contained in the header
* file (MRUN211.H). Menu selections are fielded by parsemenu()
* and the toolbar is controlled by parseobject(). The routines
* associated with menu items are contained in the header file
* immediately following parsemenu() and parseobject(). Some of
* these in turn call routines in other script modules through
* the callscript() procedure. Where necessary, a FLAG is set to
* inform the target module which routines to execute.
*
* The code for the interface is #included in every module of
* MailRun so that any part of the script may be called from any
* other part. Other script modules are called by MRUN211A and
* MRUN211G (the module responsible for executing the mailrun)
* using the "execute" command. When a module is called from
* MRUN211B-F, a "chain" command is used.
*
**************************************************************************
**************************************************************************
#endcomment
#define MRUN211A
#define MRUN211AG
#define MRUN211AB
string MainBoxTabs
integer RingInterrupt, AutoRun
integer MailRunMenu, RunningMenu, FileMenu, ConfigMenu, AddMenu
integer DefaultsMenu, ExecuteMenu, HelpMenu, EditMenu
#include "mrun211.h"
#define HAVEYOUPAID;YOURFIFTEENDOLLARSYET
#comment
*********************************************************************
*
* MAIN()
*
* Calls checkchild(), initialize(), maketasklist(),
* makemailrunlist(), runmenu(), mrunmenu(), mrunwin(),
* getfirstitem(), helpabout(), parsedialog(), parsekeystate(),
* interfaceon(), executor(), makefullname()
*
* Main first calls the initialization routines, then puts
* up the main dialog box and waits for user action.
*
*********************************************************************
#endcomment
proc main
string MRunIcons
checkchild()
initialize()
runmenu()
mrunmenu()
mrunwin()
makemailrunlist()
maketasklist()
getfirstitem()
showmenu MailRunMenu
if AutoRun == 1
filereset()
FLAGS |= RUNNING
GoWait = 1
PostRun = 3
pause 2
else
#ifdef HAVEYOUPAID;YOURFIFTEENDOLLARSYET
helpabout()
#else
mailrunbox()
#endif
endif
interfaceon()
MRunIcons = makefullname(MailRunDir, "MRUNICON.DLL")
when dialog call parsedialog
while 1
if FLAGS & RUNNING
copyfile MRunIcons "C:\MRUNICON.DLL"
switch $XPIXELS
case 1280
iconbutton 1 25 0 "" "C:\MRUNICON.DLL" 16 userwin
endcase
case 1024
iconbutton 1 30 0 "" "C:\MRUNICON.DLL" 16 userwin
endcase
case 800
iconbutton 1 40 0 "" "C:\MRUNICON.DLL" 16 userwin
endcase
default
iconbutton 1 50 0 "" "C:\MRUNICON.DLL" 16 userwin
endcase
endswitch
paint
delfile "C:\MRUNICON.DLL"
showmenu RunningMenu
executor()
copyfile MRunIcons "C:\MRUNICON.DLL"
switch $XPIXELS
case 1280
iconbutton 1 25 0 "" "C:\MRUNICON.DLL" 0 userwin
endcase
case 1024
iconbutton 1 30 0 "" "C:\MRUNICON.DLL" 0 userwin
endcase
case 800
iconbutton 1 40 0 "" "C:\MRUNICON.DLL" 0 userwin
endcase
default
iconbutton 1 50 0 "" "C:\MRUNICON.DLL" 0 userwin
endcase
endswitch
paint
delfile "C:\MRUNICON.DLL"
showmenu MailRunMenu
endif
endwhile
endproc
#comment
*********************************************************************
*
* INITIALIZE()
*
* Called by main()
*
* Calls cleardir(), makemrn(), makefullname(), checkfile()
*
* Saves system state and initializes global variables.
*
*********************************************************************
#endcomment
proc initialize
string LastRun, env, temp , CleanupFile
string StateCapPath, StateCapFile, StateDnldPath, StateUpldPath
integer StateAutoDL, StateActionBar, StateMetaKeys
integer blank = 0
;Create the working directory
getenv "TEMP" env
if NULLSTR env
TempDir = makefullname($PWTASKPATH, "MRUNTEMP")
else
TempDir = makefullname(env, "MRUNTEMP")
endif
FLAGS = 0
MailRunIni = makefullname($WINPATH, "MAILRUN.INI")
profilerd MailRunIni "MailRun" "MailRun" MailRunTrunc
profilerd MailRunIni "MailRun" "MailRunDir" MailRunDir
profilerd MailRunIni "MailRun" "AutoRun" AutoRun
;Save the current state of PCPlus/Win
fetch autodnld StateAutoDL
fetch capture path StateCapPath
fetch capture file StateCapFile
fetch dnldpath StateDnldPath
fetch upldpath StateUpldPath
StateActionBar = $ACTIONBAR
StateMetaKeys = $METAKEYS
;Save the system state in the cleanup file
cleanupfile = makefullname(TempDir, "CLEANUP.TMP")
profilewr CleanupFile "Cleanup" "StateAutoDL" StateAutoDL
profilewr CleanupFile "Cleanup" "StateCapPath" StateCapPath
profilewr CleanupFile "Cleanup" "StateCapFile" StateCapFile
profilewr CleanupFile "Cleanup" "StateDnldPath" StateDnldPath
profilewr CleanupFile "Cleanup" "StateUpldPath" StateupldPath
profilewr CleanupFile "Cleanup" "StateActionBar" StateActionBar
profilewr CleanupFile "Cleanup" "StateMetaKeys" StateMetaKeys
;Change the settings
set capture path MailRunDir
set capture query OFF
set autodnld OFF
set aspect rangechk OFF
metakeys OFF
actionbar OFF
;If the mailrun in MAILRUN.INI doesn't exist, create it
if NULLSTR MailRunTrunc
blank = 1
else
LastRun = makefullname(MailRunDir, MailRunTrunc)
endif
if !(checkfile(LastRun)) || blank
temp = makefullname(MailRunDir, "*.MRN")
findfirst temp
if FOUND
MailRunTrunc = $FILENAME
LastRun = makefullname(MailRunDir, MailRunTrunc)
else
MailRunTrunc = "mailrun.mrn"
MailRunList = "mailrun.mrn"
makemrn()
LastRun = MailRun
endif
endif
;Copy the mailrun to the temp directory
MailRun = makefullname(TempDir, MailRunTrunc)
TaskList = makefullname(TempDir, "TASKLIST.TMP")
copyfile LastRun MailRun
profilerd MailRun "MailRun" "Archiver" Archiver
profilerd MailRun "MailRun" "QWKReader" QWKReader
profilerd MailRun "MailRun" "LogViewer" LogViewer
endproc
#comment
*********************************************************************
*
* EXECUTOR()
*
* Called by main()
*
* Calls schedulebox(), mailrunbox(), checktime(), fileexit(),
* scheduler(), domailrun(), makefullname(), filereset(),
* maketasklist()
*
* Executes MRUN211G
*
* Puts up the MailRun Scheduling box and parses the result.
*
*********************************************************************
#endcomment
proc executor
string HH, MM, SS, temp, LogFile, domailrun
integer Hour, Minute, Second
integer dialogstatus, boxstatus
domailrun = makefullname(MailRunDir, "MRUN211G")
findfirst MailRun
LogFile = $FNAME
strcat LogFile ".CAP"
if AppendLog == 0
;if user does not want to append to existing log file
temp = makefullname(MailRunDir, LogFile)
delfile temp
endif
set capture file LogFile
profilerd MailRun "MailRun" "RingInterrupt" RingInterrupt
if AutoRun == 0
profilerd MailRun "MailRun" "ExecTime" ExecTime
profilerd MailRun "MailRun" "PostRun" PostRun
profilerd MailRun "MailRun" "GoWait" GoWait
schedulebox()
if GoWait == 1
disable CTRL 230
endif
endif
;boxstatus indicates whether or not mailrunbox is showing
boxstatus = 0
;turn off parsedialog() for parsing contols
clearwhen dialog
while (FLAGS & RUNNING) && (AutoRun == 0)
dialogstatus = $DIALOG
switch dialogstatus
case 1
;User selected "Cancel"
FLAGS &= IDLE
mailrunbox()
boxstatus = 1
;turn b